import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.lang3.RandomStringUtils;
import sun.security.provider.MD5;

import java.util.HashSet;

/***
 * @author hunter.d
 * @qq 657270652
 * @wx haitao-duan
 * @date 2020/10/5
 **/
public class Md5Hash {
    public static void main(String[] args) {


        System.out.println(DigestUtils.md5Hex("u3"));
        System.out.println(DigestUtils.md5Hex("u7"));
        System.out.println(DigestUtils.md5Hex("d4"));

        HashSet<String> set1 = new HashSet<>();
        HashSet<Integer> set2 = new HashSet<>();
        HashSet<Integer> set3 = new HashSet<>();
        for(int i =0 ;i < 100000 ; i++){
            String s = RandomStringUtils.randomAlphabetic(5, 6);
            set1.add(s);
            set2.add(DigestUtils.md5Hex(s).substring(0,12).hashCode());
            set3.add(s.hashCode());
        }

        System.out.println(set1.size());
        System.out.println(set2.size());
        System.out.println(set3.size());


    }
}
